<html style="background:none !important">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<?php echo base_url() ?>css/style.css" type="text/css">
<style type="text/css">
body {
	background:none !important;
	font-size:15px !important;
	font-family:'Times New Roman', Times, serif;
}
.fr,
.fr_2 {
	font-family:'Times New Roman', Times, serif;
	font-size:18px !important;
	padding:2px 5px !important;
}
.strong {
	font-weight: bold;
}
</style>
<script type="text/javascript">
document.title = 'Hóa đơn <?php echo $data['ma'] ?>';
</script>
</head>
<body>
<div style="width:10.6in; position:relative;">
	<table width="100%">
		<tr>
			<td class="fr" align="center" colspan="3"><h1>HÓA ĐƠN BÁN HÀNG</h1></td>
		</tr>
		<tr>
		    <td class="fr" valign="top" width="30%" style="border: none;">
		        <h1>ĐỊA CHỈ THANH TOÁN</h1>
		        <h2><?php echo $info['ten_nguoimua'] ?></h2>
		        <p><?php echo $info['diachi_nguoimua'] ?></p>
		        <p>Tel: <?php echo $info['dienthoai_nguoimua'] ?></p>
		        <p>Email: <?php echo $info['email_nguoimua'] ?></p>
		    </td>
		    <td class="fr" valign="top" width="40%" style="border: none;">
		        <h1>ĐỊA CHỈ GIAO HÀNG</h1>
		        <h2><?php echo $info['ten_nguoinhan'] ?></h2>
		        <p><?php echo $info['diachi_giaohang'] ?></p>
		        <p>Tel: <?php echo $info['dienthoai_nguoinhan'] ?></p>
		        <p>Ghi chú: <?php echo $info['khachhang_ghichu'] ?></p>
		    </td>
		    <td class="fr" valign="top" width="30%" style="border: none;">
		        <h1>THÔNG TIN HÓA ĐƠN</h1>
		        <h2>Mã hóa đơn: <?php echo $info['ma'] ?></h2>
		        <p>Ngày đặt hàng: <?php echo strftime(TIME_STR, strtotime($info['date_added'])) ?></p>
		        <p>Tình trạng: <?php echo $GLOBALS['orders_status'][$info['status']] ?></p>
		        <p style="clear: both">Hình thức thanh toán: <?php echo ($info['phuongthuc_thanhtoan'] == 0? 'tiền mặt' : ($info['phuongthuc_thanhtoan'] == 1 ? 'chuyển khoản' : ($info['phuongthuc_thanhtoan'] == 2 ? 'Paypal' : ($info['phuongthuc_thanhtoan'] == 3 ? 'Ngânlượng.vn' : ($info['phuongthuc_thanhtoan'] == 4 ? 'BảoKim.vn' : 'Sohapay'))))) ?></p>
		    </td>
		</tr>
		<tr>
			<td colspan="3">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
		            <tr id="first">
		                <td class="head" width="2%">#</td>
		                <td class="head" width="430px">Sản phẩm</td>
		                <td class="head center" align="center" width="100px">Mã hàng</td>	
		                <td class="head center" width="30px">SL</td>
		                <td class="head right" width="100px">Đơn Giá</td>
		                <td class="head right" width="50px">Thành tiền</td>
		            </tr>
		            <?php
		            $products = $methods->product_list($info['ma']);
		            if (count($products) && is_array($products))
		            {
			            $i = 1;
			            foreach ($products as $pro)
			            {
		            ?>
		            <tr>
		                <td class="fr" width="2%"><?php echo $i++ ?></td>
		                <td class="fr" width="430px"><?php echo $pro['name_vn'] ?></td>
		                <td class="fr center" align="center" width="100px"><?php echo $pro['code'] ?></td>
		                <td class="fr center" width="30px"><?php echo number_format($pro['soluong']) ?></td>
		                <td class="fr right" width="100px"><?php echo number_format($pro['gia']) ?></td>
		                <td class="fr right" width="50px"><?php echo number_format($pro['tongcong']) ?>đ</td>
		            </tr>
		            <?php
		            	}
		        	}
		            if ($info['vat'] || $info['giam_coupon'] || $info['phi_giaohang'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr right" colspan="5" style="border: 0">Tổng cộng</td>';
		            	echo '<td class="fr right" style="border: 0">'.number_format($info['tongcong']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['vat'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr right" colspan="5" style="border: 0">VAT 10%</td>';
		            	echo '<td class="fr right" style="border: 0">'.number_format($info['vat']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['giam_coupon'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr right" colspan="5" style="border: 0">Giảm Coupon</td>';
		            	echo '<td class="fr right" style="border: 0">'.number_format($info['giam_coupon']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['phi_giaohang'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr right" colspan="5" style="border: 0">Phí giao hàng</td>';
		            	echo '<td class="fr right" style="border: 0">'.number_format($info['phi_giaohang']).'đ</td>';
		            	echo '</tr>';
		            }
		            ?>
		            <tr>
		            	<td class="fr right strong" colspan="5" style="border: 0">Thanh toán</td>
		            	<td class="fr right strong" style="border: 0"><?php echo number_format($info['tien_thanhtoan']) ?>đ</td>
		            </tr>
		            <tr>
		            	<td class="fr right" colspan="6" style="border: 0"><em>Bằng chữ: <?php echo doiso($info['tien_thanhtoan']) ?> đồng</em></td>
		            </tr>
		        </table>
			</td>
		</tr>
	</table>
</div>
</body>
</html>